package 刷题10月.leecodehot100;
import java.util.Scanner;
//http状态码判断错误
public class Main2 {
    public static  boolean isTrue(int code){
        String code1=String.valueOf(code);
       for(int i=0;i<3;i++){
           if(code1.charAt(0)=='4'||code1.charAt(0)=='5'){
               return true;
           }
           else{
               return false;
           }
       }
       return false;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x=0;
        String arr[]=new String[n];
        for(int i = 0; i < n; i++){
            x = sc.nextInt();
            if(isTrue(x)==true){
                arr[i]="Yes";
            }
            else {
                arr[i]="No";
            }
        }
        for(String a:arr){
            System.out.println(a);
        }
    }
}